package com.kid.springcloud.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@Slf4j
@RestController
@RefreshScope//不重启即可获得配置的自动刷新
public class NacosConfigClientController {

    @Value("${config.ip}")
    private String configIp;
    @Value("${config.name}")
    private String configName;
    @GetMapping("/nacos/config/ip")
    public String getConfigIp() {
        return configIp;
    }
    @GetMapping("/nacos/config/name")
    public String getConfigName(){
        return configName;
    }
}
